#!/usr/bin/python
# -*- coding: utf-8 -*-


from django.http import HttpResponseRedirect
from django.http import HttpResponse
from django.utils import simplejson



def json_wrapper(request, data,varname="data"):
    try:
        message ={varname:data.encode("utf-8")}
    except:
        message ={varname:str(data)}
    return HttpResponse(simplejson.dumps(message), mimetype='application/json')


def get_socket(request):
    import tasks
    task_id=1
    SocketServerStart.AsyncResult()
    result.get()
    return json_wrapper(request,data,"socket")
